package ruixinyi.experiment2.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ruixinyi.experiment2.entity.Grade;
import ruixinyi.experiment2.repository.GradeRepository;
import java.util.List;
@Service
public class GradeService {
    @Autowired
    private GradeRepository gradeRepository;

    public List<Grade> findAll() {
        return gradeRepository.findAll();
    }

    public Grade save(Grade grade) {
        return gradeRepository.save(grade);
    }

    public List<Grade> findByStudentId(Integer studentId) {
        return gradeRepository.findByStudentId(studentId);
    }

    public List<Grade> findByCourseId(Integer courseId) {
        return gradeRepository.findByCourseId(courseId);
    }

    public List<Grade> findByScoreRange(Double minScore, Double maxScore) {
        return gradeRepository.findByScoreBetween(minScore, maxScore);
    }
}